#include <stdio.h>
#include "uthash-1.9.7/uthash.h"
#include "uthash-1.9.7/utlist.h"
#include "uthash-1.9.7/utarray.h"
#include <stdlib.h>
#include <unistd.h>
UT_array *header;
UT_icd   int_icd={sizeof(int),NULL,NULL,NULL};
int compare(const void *a,const void *b)
{
	int *pa=(int*)a;
	int *pb=(int*)b;
	printf("va=%d\n",*pa);
	printf("vb=%d\n",*pb);
	return *pa-*pb;
}
int main()
{
	utarray_new(header,&int_icd);
	int i=10;
	utarray_push_back(header,&i);
	i=9;
	utarray_push_back(header,&i);
	i=15;
	utarray_push_back(header,&i);
	i=17;
	utarray_push_back(header,&i);
	i=1;
	utarray_push_back(header,&i);
	utarray_sort(header,compare);
	i=15;
	void *ret=utarray_find(header,&i,compare);
	printf("find:%d ret=%p\n",i,ret);
	if(NULL!=ret){
		printf("find value:%d\n",*(int*)ret);
	}
	i=14;
	ret=utarray_find(header,&i,compare);
	printf("find:%d ret=%p\n",i,ret);
}
